package com.shirley.pers.zhufengfmvi.tasks;

import com.shirley.pers.zhufengfmvi.client.ClientAPI;

import java.util.Map;

/**
 * Description: 获取曲目详情的异步任务<br/>
 * <p/>
 * Copyright (c) , 2016, Shirley Xian <br/>
 * This program is protected by copyright laws. <br/>
 * ClassName: AlbumsDetailTask<br/>
 * Date: 2016/4/8 11:17
 *
 * @author Shirley Xian
 * @version 1.0
 */
public class AlbumsDetailTask extends BaseTask {

    private long pageNum;
    private long pageSize;
    private long albumId;
    private boolean isAsc;

    public AlbumsDetailTask(TaskCallback taskCallback, long pageNum, long pageSize, long albumId, boolean isAsc) {
        super(taskCallback);
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.albumId = albumId;
        this.isAsc = isAsc;
    }

    /**
     * Override this method to perform a computation on a background thread. The
     * specified parameters are the parameters passed to {@link #execute}
     * by the caller of this task.
     * <p/>
     * This method can call {@link #publishProgress} to publish updates
     * on the UI thread.
     *
     * @param params The parameters of the task.
     * @return A result, defined by the subclass of this task.
     * @see #onPreExecute()
     * @see #onPostExecute
     * @see #publishProgress
     */
    @Override
    protected TaskResult doInBackground(String... params) {

        String json = ClientAPI.getAlbumsDetail(pageNum, pageSize, albumId, isAsc);
        return getTaskResult(json, new TaskResult());
    }
}
